/* Cursor Account Manager - Sidebar Styles */

:root {
  --primary-color: #4f46e5;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;

  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-hover: #e2e8f0;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --border-color: #e2e8f0;
  --border-radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Dark mode */
body.dark-mode {
  --bg-primary: #1a1a1a;
  --bg-secondary: #262626;
  --bg-tertiary: #333333;
  --bg-hover: #404040;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border-color: #404040;
}

/* Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100%;
  height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow: hidden;
}

#sidebar-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title .icon {
  font-size: 20px;
}

.title h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  padding: 6px;
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: var(--bg-hover);
}

/* Current Account */
.current-account-section {
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.current-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.current-account {
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-account .account-icon {
  font-size: 16px;
}

.current-account .account-details {
  flex: 1;
  min-width: 0;
}

.current-account .account-name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.current-account .account-status {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Quick Actions */
.quick-actions {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* Accounts Section */
.accounts-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.section-header h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.count {
  font-size: 12px;
  color: var(--text-muted);
}

/* Sidebar Accounts List */
.sidebar-accounts-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar-account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-account-item:hover {
  background: var(--bg-hover);
  transform: translateX(2px);
}

.sidebar-account-item.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.sidebar-account-item.active .account-details,
.sidebar-account-item.active .account-status {
  color: rgba(255, 255, 255, 0.9);
}

.sidebar-account-item .account-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.sidebar-account-item .account-avatar {
  position: relative;
  flex-shrink: 0;
}

.sidebar-account-item .account-icon {
  font-size: 20px;
}

.sidebar-account-item .account-details {
  flex: 1;
  min-width: 0;
}

.sidebar-account-item .account-email {
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.sidebar-account-item .account-status {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 500;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-tertiary);
}

.sidebar-account-item .account-status.free {
  background: #e3f2fd;
  color: #1976d2;
}

.sidebar-account-item .account-status.pro {
  background: #f3e5f5;
  color: #7b1fa2;
}

.sidebar-account-item .account-status.business {
  background: #e8f5e9;
  color: #388e3c;
}

.dark-mode .sidebar-account-item .account-status.free {
  background: #1e3a5f;
  color: #64b5f6;
}

.dark-mode .sidebar-account-item .account-status.pro {
  background: #4a148c;
  color: #ba68c8;
}

.dark-mode .sidebar-account-item .account-status.business {
  background: #1b5e20;
  color: #81c784;
}

.sidebar-account-item .account-actions {
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.sidebar-account-item:hover .account-actions {
  opacity: 1;
}

.sidebar-account-item .reveal-btn,
.sidebar-account-item .delete-btn {
  padding: 4px;
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.sidebar-account-item .reveal-btn:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

.sidebar-account-item .delete-btn:hover {
  color: var(--danger-color);
  transform: scale(1.1);
}

.sidebar-account-item .active-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 8px;
  color: var(--success-color);
  background: white;
  padding: 1px 3px;
  border-radius: 8px;
  display: none;
}

.sidebar-account-item.active .active-indicator {
  display: block;
}

/* Buttons */
.btn {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #4338ca;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.empty-state p {
  margin: 4px 0;
  font-size: 12px;
}

.empty-state .hint {
  font-size: 11px;
  opacity: 0.7;
}

/* Loading */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.dark-mode .loading-overlay {
  background: rgba(26, 26, 26, 0.9);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-overlay p {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Notification */
.notification {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  z-index: 1001;
  text-align: center;
}

.notification.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.notification.error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.notification.info {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.dark-mode .notification.success {
  background: #14532d;
  color: #bbf7d0;
}

.dark-mode .notification.error {
  background: #7f1d1d;
  color: #fecaca;
}

.dark-mode .notification.info {
  background: #1e3a8a;
  color: #bfdbfe;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: var(--bg-primary);
  margin: 10% auto;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 16px;
}

.modal-body p {
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.modal-body textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  resize: vertical;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-group {
  margin-top: 12px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 11px;
}

.form-group input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 12px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
}

/* Enhanced Scrollable Lists */
.scrollable {
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 6px;
  padding-right: 4px;
}

.scrollable::-webkit-scrollbar {
  width: 8px;
}

.scrollable::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.scrollable::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.scrollable::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* Account and Card Filters - Dark/Light Mode Compatible */
.account-filters,
.card-filters {
  margin: 10px 0;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.filter-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.filter-input::placeholder {
  color: var(--text-secondary);
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  min-width: 140px;
  transition: all 0.2s ease;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.filter-select option {
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 8px;
}

/* Legacy Scrollbar (Fallback) */
.sidebar-accounts-list::-webkit-scrollbar {
  width: 6px;
}

.sidebar-accounts-list::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.sidebar-accounts-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.sidebar-accounts-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Duplicate warning styles */
.duplicate-warning {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  padding: 8px;
  margin: 8px 0;
  color: #dc2626;
  font-size: 11px;
}

.dark-mode .duplicate-warning {
  background: #7f1d1d;
  border-color: #dc2626;
  color: #fca5a5;
}

/* Tab Navigation for Sidebar */
.tab-navigation {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 3px;
  margin-bottom: 12px;
  gap: 3px;
}

.tab-btn {
  flex: 1;
  padding: 6px 8px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.tab-content {
  display: none; /* Hidden by default */
  animation: fadeInSidebar 0.15s ease-in-out;
}

#accountsContent {
  display: block; /* Show accounts tab by default */
}

@keyframes fadeInSidebar {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Payment Cards for Sidebar */
.cards-section {
  margin-top: 12px;
}

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.cards-list::-webkit-scrollbar {
  width: 6px;
}

.cards-list::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.cards-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.card-item:hover {
  background: var(--bg-hover);
  border-color: var(--primary-color);
}

.card-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--bg-primary);
  border-radius: 4px;
  font-size: 12px;
}

.card-details {
  flex: 1;
  min-width: 0;
}

.card-number {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 11px;
  margin-bottom: 2px;
  font-family: "Courier New", monospace;
}

.card-meta {
  display: flex;
  gap: 8px;
  font-size: 10px;
  color: var(--text-secondary);
}

.card-expiry {
  font-family: "Courier New", monospace;
}

.card-type {
  font-weight: 500;
}

.card-actions {
  display: flex;
  gap: 3px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.card-item:hover .card-actions {
  opacity: 1;
}

.fill-btn {
  padding: 4px 6px;
  border: 1px solid var(--success-color);
  border-radius: 3px;
  background: transparent;
  color: var(--success-color);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fill-btn:hover {
  background: var(--success-color);
  color: white;
}

.remove-card-btn {
  padding: 4px 6px;
  border: 1px solid var(--danger-color);
  border-radius: 3px;
  background: transparent;
  color: var(--danger-color);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-card-btn:hover {
  background: var(--danger-color);
  color: white;
}

/* Payment Form Info */
.form-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px;
  margin-top: 8px;
}

.info-header {
  font-weight: 500;
  color: var(--success-color);
  margin-bottom: 4px;
  font-size: 11px;
}

/* Debug Panel for Sidebar */
.debug-section {
  margin-bottom: 12px;
}

.debug-toggle {
  font-size: 11px;
  margin-bottom: 8px;
}

.debug-panel {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px;
  background: var(--bg-secondary);
  margin-bottom: 12px;
}

.debug-panel h3 {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-primary);
}

.debug-actions {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.debug-output {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px;
  font-family: "Courier New", Courier, monospace;
  font-size: 10px;
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
  color: var(--text-primary);
}

.cards-count {
  color: var(--text-muted);
  font-size: 10px;
}
